<?php

if (!empty($_POST['solde'])){
	
		if ((isset($_POST['begin']))&&(isset($_POST['end']))&&(isset($_POST['solde']))){
			$d=substr($_POST['end'],0,2);
			$m=substr($_POST['end'],3,2);
			$y=substr($_POST['end'],6,4);
			$end=''.$y.'-'.$m.'-'.$d.' ';
			
			
			$a=substr($_POST['begin'],0,2);
			$b=substr($_POST['begin'],3,2);
			$c=substr($_POST['begin'],6,4);
			$begin=''.$c.'-'.$b.'-'.$a.'';
			
						
			$percent=$_POST['solde'];
			
	
			if(isset($_POST['products'])){
				foreach($_POST['products'] as $id){
					
					$product=new Product($id);
					$product->load();
					$product->setSoldPrice($percent,$begin,$end);
					$product->save();
					
					
				}
			}
		}
}


	



		
		

?>